<div class="content-form edit-aluno">
    <?php echo $this->partial('aluno/menu.phtml', array('urlbase'=>$this->urlbase,'urlfoto'=>$this->urlfoto,'modulo'=>$this->modulo,'controller' => $this->controller, 'action' => $this->action, 'data' => $this->data)); ?>
    
    <div id="content-form">
        
        <div class="content-form-top">
        
            <h2><?php echo $this->Menualuno_nom[$this->action];?></h2>
            
        </div>
        
        <form id="form_aluno" action="" method="post">    
            <input type="hidden" id="BTD_ID" name="BTD_ID" value="<?php echo $this->result['BTD_ID']; ?>" />
            <input type="hidden" id="ALU_ID" name="ALU_ID" value="<?php echo $this->data['ALU_ID']; ?>" />
            
            <div class="row">
                <div class="ln"><strong style="display: inline-block;width: 135px;">Instituição de Ensino</strong>
                <?php
                    $html = '<select name="FAC_ID" class="faculdade" required><option value="">Nenhum</option>'; // multiple="multiple" style="width: 400px;min-height: 70px;">
                    $query = 'SELECT SQL_CACHE FAC_ID,FAC_NOM FROM FACULDADE WHERE FAC_STA = 1 ORDER BY FAC_NOM ASC';
                    $row = $this->db->fetchAll($query);
                    $arr = array();
                    foreach($row as $r){ 
                        $selected = $r['FAC_ID'] == $this->result['FAC_ID'] ? 'selected=""':'';            
                        $html .= '<option '.$selected.' value="'.$r['FAC_ID'].'">'.$r['FAC_NOM'].'</option>'; 
                    }
                    echo $html .= '</select>';
                ?>
                </div>
                <div class="ln"><strong style="display: inline-block;width: 135px;">Prova</strong>
                <?php
                    $html = '<select name="FAP_ID" class="provas" required><option value="0">Nenhum</option>'; // multiple="multiple" style="width: 400px;min-height: 70px;">
                    $query = 'SELECT SQL_CACHE FAP_ID,FAP_NOM FROM FACULDADE_PROVA WHERE FAC_ID = "'.$this->result['FAC_ID'].'" AND FAP_STA = 1 ORDER BY FAP_NOM ASC';
                    $row = $this->db->fetchAll($query);
                    $arr = array();
                    foreach($row as $r){  
                        $selected = $r['FAP_ID'] == $this->result['FAP_ID'] ? 'selected=""':'';
                        $html .= '<option '.$selected.' value="'.$r['FAP_ID'].'">'.$r['FAP_NOM'].'</option>'; 
                    }
                    echo $html .= '</select>';
                ?>
                </div>
                <div class="ln"><strong style="display: inline-block;width: 135px;" required>Ano</strong>
                    <input type="text" name="BTD_ANO" value="<?php echo $this->result['BTD_ANO']; ?>" class="nummin" maxlength="4" required />
                </div>
                <div class="ln"><strong style="display: inline-block;width: 135px;" required>Semestre</strong>
                    <input type="text" name="BTD_SEM" value="<?php echo $this->result['BTD_SEM']; ?>" class="nummin" required />
                </div>
                
                <div class="ln disciplinas">
                <?php
                    $html = '';
                    $query = 'SELECT SQL_CACHE b.*,d.DCP_NOM FROM BOLETIM_DESEMPENHO_DISC b, DISCIPLINA d WHERE b.BTD_ID = "'.$this->result['BTD_ID'].'" AND b.DCP_ID = d.DCP_ID ORDER BY b.BDD_ID';
                    $row = $this->db->fetchAll($query);
                    foreach($row as $r){  
                        $html .= '<div class="cnt_el">';
                        $html .= 'Disciplina: <span class="cmp_m">'.$r['DCP_NOM'].'</span> <input type="hidden" name="d[]" value="'.$r['DCP_ID'].'" >';
                        $html .= ' &nbsp; Nº Questões: <input type="text" class="nummin" name="n[]" value="'.$r['BDD_NQU'].'" readonly="">';
                        $html .= ' &nbsp; Peso: <input type="text" class="nummin" name="p[]" value="'.$r['BDD_PES'].'" readonly="">';
                        $html .= ' &nbsp; Acertos: <input type="text" class="nummin" name="a[]" value="'.$r['BDD_ACT'].'" maxlength="3">';
                        $html .= '</div>';
                    }
                    echo $html;
                ?>
                </div>
                
            </div> 
            
            <div class="row cnt-frm-btn">
                <input type="submit" name="submit" id="submitbutton" value="Salvar" class="btn-frm">

                <a href="<?php echo $this->urlmodulo.'/'.$this->controller.'/'.$this->action.'/id/'.$this->data['ALU_ID']; ?>" class="btn-frm">voltar</a>
            </div>
        </form>
    </div>
</div>

<div id="script"></div>